<script type="text/javascript">

    var xmlHttp;
    function S_xmlhttprequest() {
        if(window.ActiveXObject) {
            xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
        } else if(window.XMLHttpRequest) {
            xmlHttp = new XMLHttpRequest();
        }
    }

    function url_jump()
    {

        //yuqing
        var cell_msg = document.getElementById('msg_tab').rows[1].cells;

        var sku = cell_msg[3].innerHTML;

        if(sku == ''){
            return false;
        }
        var logic = document.getElementById('slt_logic');
        if(logic!=null){
            var logic_v = logic.value;
            if(logic_v==''){
                alert('请选择物流属性');
                return false;
            }
        }
        //
        //yuqing ----begin------
        //VMI预约单号 收货明细ID
        var pu_id               = cell_msg[1].innerHTML;
        var recieve_detail_id   = cell_msg[2].innerHTML;

        //yuqing ----end--------

        var ob = 'logic_v='+logic_v+'&sku='+sku+"&pu_id="+pu_id+"&recieve_detail_id="+recieve_detail_id;
        var url = "<?php echo url::base(true)?>checkattr/updateAttr?"+ob;

        S_xmlhttprequest();
        xmlHttp.open("GET",url,true);
        xmlHttp.onreadystatechange = byContent;
        xmlHttp.send(null);

    }


    function checkForm(){
        var count = form1.orderid.value;
        var count = Number(count);
        if(isNaN(count)){

            alert('非法输入！');
            return false;
        }
    }


    function byContent() {

        if(xmlHttp.readyState == 4 ){

            if(xmlHttp.status == 200) {
                var bytext  =  xmlHttp.responseText;
                var data    = JSON.parse(bytext);
                var msg = "";
                if(data['sku_logic']==1){
                    msg = "SKU物流属性审核成功\n";
                }else{
                    msg = "SKU物流属性未更新\n";
                }
                if(data['insert']){
                    msg += "审核人员信息添加成功";
                }
                alert(msg);
                window.location.reload();

            }
        }
    }

</script>


    <form action="" method="get" name="form1" onsubmit="return checkForm();" class="form-horizontal">
        <div class="control-group">
            <lable class="control-label">扫描收货明细单号：</lable>
            <div class="controls">
                <input type='text' name="orderid" value="<?php echo $_GET['orderid']; ?>">
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
             <input type='submit' name='sub' value='查询' class="btn btn-info">
            </div>
        </div>
    </form>


<?php if($huo){ ?>

    <!-- Table goes in the document BODY -->
    <table class="table table-bordered" id="msg_tab">
        <thead>
        <tr>
            <th>供应商名称</th>
            <th>VMI预约单号</th>
            <th>收货明细单号</th>
            <th>sku</th>
            <th>中文名称</th>
            <th>所属仓库</th>
            <th>备注</th>
<!--            <th>审核人员</th>-->
<!--            <th>审核时间</th>-->
            <th><?php echo  isset($logic) ? '属性' : '请选择属性';?></th>
            <th>到货量</th>
            <th>需质检量</th>
            <th>操作</th>
        </tr>
        </thead>

        <?php

        foreach ($huo as $value) {


            ?>
<tbody>
            <tr>
                <td><?php echo $value['supplier'];?></td>
                <td><?php echo $value['purchaseorder_id'];?></td>
                <td><?php echo $value['id'];?></td>
                <td><?php echo $value['sku'];?></td>
                <td><?php echo $value['sku_name'];?></td>
                <td><?php echo isset($store['storeName']) ? $store['storeName'] : '未知仓库';?></td>
                <td><?php echo $remark;?></td>
<!--                <td>--><?php //echo $userName? $userName:"无" ?><!--</td>-->
<!--                <td>--><?php //echo $checkTime ? $checkTime :"无" ?><!--</td>-->
                <td><?php echo isset($logic) ? "<lable style='color: #ff0000'>".$logic."</lable>" : $showSelect ?></td>
                <td><?php echo $value['arrival_quantity'];?></td>
                <td><?php echo $value['xu_check'];?></td>
                <input type="hidden" name="store" id="store" value = "<?php echo isset($store['storeId']) ? $store['storeId'] : 0;?>">
                <input type='hidden' name="check_count<?php echo $value['id'];?>" id="check_count<?php echo $value['id'];?>" value="<?php echo $value['xu_check']; ?>" style='width:50px'>
                <input type="hidden" name="arrival_count<?php echo $value['id'];?>" id="arrival_count<?php echo $value['id'];?>" value="<?php echo $value['arrival_quantity']; ?>">

                <td>
                    <?php
                    if(!$isChecked){?>
                            <input type='button' class="btn btn-info" onclick="return url_jump()"  value='审核'>
                    <?php
                        }else{
                        echo "已经属性确认";
                    }
                    ?>
                </td>
            </tr>
</tbody>
        <?php
        }
        ?>


    </table>

<?php } ?>
